package com.gitee.maskit.web;

import com.gitee.maskit.utils.Response;
import org.springframework.web.method.HandlerMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author z0228
 */
public interface ResponseBuilder {
    /**
     * Return all {@link Class}s this builder can handle
     *
     * @return list of {@link Class}s build can handle, not null
     */
    List<Class> capability();

    /**
     * Build {@link Response} based on exception
     *
     * @param request       {@link HttpServletRequest}
     * @param response      {@link HttpServletResponse}
     * @param handlerMethod {@link HandlerMethod}
     * @param exception     {@link Exception}
     * @return {@link Response}
     */
    Response build(final HttpServletRequest request, final HttpServletResponse response, final HandlerMethod handlerMethod, final Exception exception);
}
